home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 3 #11
/
Commodore_Disk_User_Vol.3_11_1990_-.d64
/
price calculator
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
10KB
|
272 lines
100 rem save"@0:rpi22",8
105 :
110 rem disk p14a/p14b/bu11b
115 dim p(100):rem dimension array
120 :
125 poke 53281,11:poke53280,15:poke646,15:rem set screen colours
130 :
135 rem opening menu
140 print"[147]":print" [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]
145 [153]" (NULL) ***** price calculator ***** (NULL)
150 print" [171][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][179]
155 [153]" (NULL) (c) copyright ian l dalziel 1989 (NULL)
160 print" [221] [221]
165 [153]" (NULL) 7 walker avenue (NULL)
170 print" [221] [221]
175 [153]" (NULL) troon, ayrshire, ka10 6sa (NULL)
180 print" [221] [221]
185 [153]" -tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan<
190 print" [221] [221]
195 [153]" (NULL) press ilist for instructions (NULL)
200 print" [221] [221]
205 [153]" (NULL) press ulist to update the index (NULL)
210 print" [221] [221]
215 [153]" (NULL) press tlist for technical explantion (NULL)
220 print" [221] [221]
225 [153]" (NULL) press spacelist for the program (NULL)
230 print" [221] [221]
235 [153]" mid$tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan(NULL)
240 :
245 rem branching routine
250 get z$:if z$=""then 250
255 if z$="i"then gosub 1010:goto140
260 if z$="u"then gosub 900:goto140
265 if z$="t"then gosub 715:goto140
270 if z$<>" "then 250
275 rem the main program proceeds with space key
280 :
285 rem reads data till end of file marker -1 is read
290 d=d+1:if d<>1 then 325:rem ensures data is loaded only once
295 print"[147]":print" loading data please wait 5 seconds....":print
300 x=0:rem reset x
305 rem loop to read data and give changing number on screen
310 read p(x):print x"[145]":if p(x)=-1 then 330
315 x=x+1:goto 310
320 :
325 rem calculation menu
330 print"[147]"
335 print" [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]
340 [153]" (NULL) ***** price calculator ***** (NULL)
345 print" [221] [221]
350 :
355 [143] x-1 is the last year which the rpi index is available from data
360 [153]" (NULL) applicable to the period 1900";[171](1900[170]x[171]1)"(NULL)"
365 [153]" -tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan<"
370 [153]" (NULL) press mlist for main menu elist to exit (NULL)"
375 [153]" mid$tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan(NULL)
380 print:kc$="":input" known cost of item in \....";kc$
385 if kc$="m" then 140:rem exits to main menu
390 if kc$="e" then print"[147]":end
395 :
400 rem rejects wrong input
405 kc=val(kc$):if kc=0 then print"[145]"tab(30)" [145]":goto380:
410 :
415 print:print" year of known cost...........19??[157][157]";
420 :
425 rem gets first digit of year
430 get k$:ifk$=""then 430
435 n=asc(k$):if n<48 or n>57 then 430:rem accepts only numbers
440 n$=k$:printk$;:rem first digit replaces ? on screen
445 rem gets sec0nd digit of year
450 get k$:ifk$=""then 450
455 :
460 m=asc(k$):if m<48 or m>57 then 450:rem accepts only numbers
465 m$=k$:printk$:rem second digit replaces ? on screen
470 :
475 yn=val(n$+m$):print:rem calculates the year of known price
480 rem rejects year whose rpi index is not known
485 if p(yn)<=0 then print" index not updated to include this year[155]":goto415
490 :
495 rem time delay to empty buffer to separate get statements
500 for i=1 to 100:next i
505 for i=1 to 10:get k$:next i
510 :
515 print" year you wish to know cost...19??[157][157]";
520 :
525 rem gets first digit of year
530 get k$:ifk$=""then 530
535 f=asc(k$):if f<48 or f>57 then 430:rem accepts only numbers
540 f$=k$:printk$;:rem first digit replaces ? on screen
545 :
550 rem gets sec0nd digit of year
555 get k$:ifk$=""then 555
560 g=asc(k$):if g<48 or g>57 then 450:rem accepts only numbers
565 g$=k$:printk$:rem second digit replaces ? on screen
570 :
575 yu=val(f$+g$):print:rem caculates year you want to know cost
580 rem rejects year whose rpi index is not known
585 if p(yu)<=0 then print" index not updated to include this year[155]":goto515
590 :
595 rem calculates desired price and rounds to 2 decimal places
600 q=kc/p(yn)*p(yu):q=int(q*100+0.5)/100:
605 if q>100 then q=int(q+0.5):rem no decimal places for price over \100
610 print:print" cost of item in"1900+yu"prices=\"q:
615 print" [183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183]":print
620 rem time delay to empty buffer to separate get statements
625 for i=1 to 100:next i
630 for i=1 to 10:get k$:next i
635 :
640 rem exit menu
645 print" [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]
650 [153]" (NULL) --- press space for another go --- (NULL)"
655 [153]" (NULL) (NULL)"
660 [153]" (NULL) mlist for main menu elist to exit (NULL)"
665 [153]" mid$tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan(NULL)
670 get k$:ifk$=""then670
675 if k$="e" then end
680 if k$="m" then 140
685 if k$<>" " then 670
690 goto330:rem space gives another go
695 :
700 rem data giving rpi index for 5 years starting at year of line number
705 :
710 rem subroutine for technical data info
715 print"[147]":print" how the rpi index was calculated
720 [153]" --------------------------------
725 print" the data statements give the retail
730 [153]" price index for july of each year
735 print" from 1900 to 1990 (based on jan 87=100)"
740 print" each line of data gives rpi for 5 years
745 [153]"on starting with the year of line number":[153]
750 [153]" i have estimated the july 1990 index
755 print" as +7% of july 1989 index
760 [153]:[153]:[153]:[153]:[153]:[153]:[153]:[153]:[153]:[153]
765 [153]" ------ space for one more page -------"
770 [161]k$:[139] k$[178]""[167] 770
775 :
780 [143] second page of technical info
785 [153]"load":[153]" prior to 1987 the index was calculated
790 print" from the indexes published at the time
795 [153]" as follows.......":[153]
800 [153]" from 1974-1986 the index published was
805 print" jan 74=100. this is divided by 3.945
810 [153]" (because the jan 87 index based on
815 print" jan 74=100 was 394.5)
820 [153]
825 [153]" from 1962-1973 the index published was
830 print" jan 62=100. this is divided by
835 [153]" 3.945*1.918 (because the jan74 index
840 print" based on jan 62=100 was 191.8)":print
845 print" from 1900-1961 i calculated the index
850 [153]" from the book:-britain in figures
855 print" by alan sillitoe (pelican 1973) p151":print
860 print" anyone is welcome to check the
865 [153]" calculations and let me know if you
870 print" find any major errors":print
875 print" --------- space for the menu ---------"
880 getk$:if k$=""then 880
885 return
890 :
895 rem subroutine about updating the index called from main menu
900 print"[147]":print" how the update the index
905 [153]" --------------------------------
910 print" the index for july 1990 is only an
915 [153]" estimate, so it should be corrected
920 print" once the actual index becomes known
925 [153]" in august 1990. replace the first
930 print" piece of data on line 1990 (123.6)"
935 print" with the correct index":print
940 print" in order to use the program after 1990
945 [153]" you will need to estimate the rpi for
950 print" july of the year in question by adding
955 [153]" the estimated inflation rate to the
960 print" previous year's index and replace -1
965 [153]" in the data statement with the index":[153]
970 [153]" you may continue the process each year
975 print" by making an estmate of the july index
980 [153]" in january and correcting it in august":[153]:[153]
985 [153]" --------- space for the menu ---------"
990 [161]k$:[139] k$[178]""[167] 990
995 [142]
1000 :
1005 [143] subroutine with 4 pages of worked examples called from main menu
1010 [153]"load":[153]" how to use the program
1015 print" --------------------------------
1020 [153]" example 1......":[153]
1025 [153]" say you want to know how much your
1030 print" pocket money in 1960 of 2/6p old money
1035 [153]" (12.5p in decimal money) would buy at
1040 print" todays prices":print
1045 print" for known price...enter 0.125":print
1050 print" for year of known price...enter 60":print
1055 print" for year you wish to know the price...
1060 [153]" enter 89":[153]
1065 [153]" the answer is \1.1":[153]:[153]:[153]:[153]
1070 [153]" ----- space for 3 more examples -----
1075 getk$:if k$=""then 1075
1080 :
1085 print"[147]":print" example 2........":print
1090 print" say you are treasurer of a bridge club
1095 [153]" which has been charging 40p a night
1100 print" since 1980. you are proposing
1105 [153]" an increase to 60p and want to see how
1110 print" that compares with the original charge
1115 [153]" at today's prices..":[153]
1120 [153]" for known price....enter 0.40":[153]
1125 [153]" for year of known price....enter 80":[153]
1130 [153]" for year you wish to know the price..
1135 print" enter 89":print
1140 print" the answer is 68p. so your proposed
1145 [153]" increase is less than would be needed
1150 print" to keep up with inflation
1155 [153]:[153]
1160 [153]" ----- space for 2 more examples ------"
1165 [161]k$:[139] k$[178]""[167] 1165
1170 :
1175 [153]"load":[153]" example 3........":[153]
1180 [153]" your son has just left school and
1185 print" started work in an office at a salary
1190 [153]" of \7000 per annum. you wonder how
1195 print" that compares with your first salary
1200 [153]" of \350 per annum when you started
1205 print" work in 1965.":print
1210 print" for known price...enter 7000":print
1215 print" for year of known price...enter 89":print
1220 print" for year you wish to know the price...
1225 [153]" enter 65.":[153]
1230 [153]" the answer is \899. so you son makes
1235 print" two and a half times your first
1240 [153]" salary in real terms!":[153]:[153]
1245 [153]" ------ space for 1 more example ------"
1250 [161]k$:[139] k$[178]""[167] 1250
1255 [153]"load":[153]" example 4........":[153]
1260 :
1265 [153]" you pay your gardener \2.30 per hour
1270 print" and have done so since 1985. you want
1275 [153]" to know how much you should
1280 print" increase his salary to keep its value
1285 [153]" at today's prices.":[153]
1290 [153]" for known price...enter 2.30":[153]
1295 [153]" for year of known price...enter 85":[153]
1300 [153]" for year you wish to know the price...
1305 print" enter 89.":print
1310 print" the answer is \2.79 so you should
1315 [153]" increase his wages to at least that!":[153]:[153]:[153]:[153]
1320 [153]" ------------ space for menu ----------"
1325 [161]k$:[139] k$[178]""[167] 1325
1330 [142]
1335 :
1340 [143] data statements holding rpi indexes
1345 [143] each line gives rpi for 5 years starting with year of line number
1900 [131] 2.564,2.583,2.601,2.620,2.638
1905 [131] 2.6569, 2.69212, 2.72734 ,2.76256 ,2.797786
1910 [131] 2.833, 2.9886 ,3.1442 ,3.2998, 3.4554
1915 [131] 3.611, 4.3538, 5.0966, 5.8394 ,6.5822
1920 [131] 7.325, 6.8959, 6.4668, 6.0377 ,5.6086
1925 [131] 5.1795, 5.0759, 4.9723 ,4.8687 ,4.7651
1930 [131] 4.6615 ,4.56982, 4.47814 ,4.38646 ,4.29478
1935 [131] 4.2031 ,4.51488, 4.82666, 5.13844, 5.45022
1940 [131] 5.7615 ,6.11736, 6.47322, 6.82908 ,7.18494
1945 [131] 7.5408 ,7.931802, 8.322804 ,8.713806 ,9.104808
1950 [131] 9.49581001, 9.927448 ,10.359086, 10.790724, 11.222362
1955 [131] 11.654 ,11.95282, 12.25164, 12.55046 ,12.84928
1960 [131]13.1481, 13.48418 ,13.82026 ,14.15634 ,14.49242
1965 [131] 14.8285,15.21180,15.62150,16.52010,17.4188
1970 [131] 18.6083,20.51140,21.7009,23.7494,27.8068
1975 [131] 35.1077,39.6198,46.59060,50.2155,58.0735
1980 [131] 67.9087,75.3105,81.8758,85.2978,89.1001
1985 [131] 95.2344,97.7946,101.8,106.7,115.5
1990 [131] 123.6,-1,-1,-1,-1,-1
1995 [131] -1,-1,-1,-1,-1
2000 [131] -1